<%- include('../layout/head.ejs', {pageConf})%>

<%- include('../common/navigation.ejs', { path })%>

<main>

  <div class="main">
   
    <div class="form-wrap">
      <form class="layui-form product-form js_product_form">
        <% if(isEdit) { %>
          <h1>产品编辑页面</h1>
          <% }else {%>
          <h1>产品添加页面</h1>
          <% }%>
        <% if(isEdit) { %>
        <div class="layui-form-item">
          <label class="layui-form-label"> 产品id:</label>
          <div class="layui-input-block">
            <input type="text" name="pid" id="pid" value="<%= pid%>" disabled class="layui-input" autocomplete="off"
              required lay-verify="required" />
          </div>
        </div>
        <% }%>
        <!-- 产品名 -->
        <div class="layui-form-item">
          <label class="layui-form-label">产品名</label>
          <div class="layui-input-block">
            <input type="text" name="pName" id="pName" value="<%= isEdit ? prod.pName : ''%>"
              placeholder="例如：美的电饭锅" class="layui-input" autocomplete="off" required
              lay-verify="required" />
          </div>
        </div>
        <!-- 大分类 -->
        <div class="layui-form-item">
          <label class="layui-form-label">大分类</label>
          <div class="layui-input-block">
            <input type="text" name="pBigSort" id="pBigSort" value="<%= isEdit ? prod.pBigSort : ''%>" placeholder="例如：电器"
              class="layui-input" autocomplete="off" required lay-verify="required" />
          </div>
        </div>
        <!-- 详细分类 -->
        <div class="layui-form-item">
          <label class="layui-form-label" for="pDetailSort">详细分类</label>
          <div class="layui-input-block">
            <input type="text" name="pDetailSort" id="pDetailSort" value="<%= isEdit ? prod.pDetailSort : ''%>" placeholder="例如：电饭锅" class="layui-input"
              autocomplete="off" required lay-verify="required" />
          </div>
        </div>

        <!-- 产品介绍 -->
        <div class="layui-form-item" for="pIntro">
          <label class="layui-form-label">产品介绍</label>
          <div class="layui-input-block">
            <textarea name="pIntro" id="pIntro" rows="5" placeholder="例如：蒸出低糖养生饭 保修半年 7天内有质量问题可换" class="layui-input"
              autocomplete="off" required lay-verify="required" style="height: 70px; padding: 10px;"
              ><%= isEdit ? prod.pIntro : ''%></textarea>
          </div>
        </div>

        <!-- 图片 -->
        <div class="layui-form-item">
          <label for="pImgUrl" class="layui-form-label">图片上传</label>
          <div class="upload-controller layui-input-block">
            <input type="button" id="upload" value="上传" class="layui-btn" style=" background-color: #f10215;" />
            <input type="file" name="image" id="file" class="layui-btn upFileInput" style="font-size:16px; line-height: 18px; padding-top:5px;  background-color: #f10215;" />
          </div>
        </div>
        <!-- 图片上传提示 -->
        <div class="layui-form-item">
          <div class="upload-show">
            <div class="js_upload_process layui-form-label">上传进度</div>
            <div class="js_show_img_wrap layui-input-block">
              <div class="js_show_img layui-input" style="padding-top: 5px;">已上传图片 <%= isEdit ?  '(注：编辑产品时如不更改图片可不更改)' : ''%> </div>
              <ul class="js_show_img_container"></ul>
            </div>

          </div>
        </div>
        <!-- 售价 -->
        <div class="layui-form-item">
          <label class="layui-form-label" for="pPrice">价格</label>
          <div class="layui-input-block">
            <input type="text" name="pPrice" id="pPrice" step="0.01" value="<%= isEdit ? prod.pPrice : ''%>" placeholder="例如：1299.00" class="layui-input"
              autocomplete="off" required lay-verify="required" />
          </div>
        </div>

        <!-- 进货价 -->
        <div class="layui-form-item">
          <label class="layui-form-label" for="pBuyInPrice">进货价</label>
          <div class="layui-input-block">
            <input type="text" name="pBuyInPrice" id="pBuyInPrice" value="<%= isEdit ? prod.pBuyInPrice : ''%>" placeholder="例如：1099.00" class="layui-input"
              autocomplete="off" required lay-verify="required" />
          </div>
        </div>


        <!-- 是否现货 -->
        <div class="layui-form-item">
          <label class="layui-form-label" for="pReserve">库存</label>
          <div class="layui-input-block">
            <input type="text" name="pReserve" id="pReserve" value="<%= isEdit ? prod.pReserve : ''%>" placeholder="例如：用数字表示库存的数量，如20" class="layui-input"
              autocomplete="off" required lay-verify="required" />
          </div>
        </div>


        <!-- 标签 -->
        <div class="layui-form-item">
          <label class="layui-form-label" for="pTag">商品标签</label>
          <div class="layui-input-block">
            <input type="text" name="pTag" id="pTag" value="<%= isEdit ? prod.pTag : ''%>" placeholder="例如：家用 免洗 男士专用， 也可不写" class="layui-input" autocomplete="off"
              required lay-verify="required" />
          </div>
        </div>
        <!-- 提交按钮 -->
        <div id="js_p_submit_btn" class="btn"
          style="border: 1px solid #000; padding: 5px; width: 150px; text-align: center;">添加产品</div>

      </form>
    </div>
  </div>


</main>

<%- include('../layout/foot.ejs', { pageConf })%>